/**
 * Created by Administrator on 2017/11/1.
 */
import Vue from 'vue'

export default {
  //员工列表
  StaffList(params,callback) {
    Vue.http.get('/user/list.json', {params:params}).then(function (response) {
      callback(response.data);
    });
  },
  //员工详情
  StaffDetail(params,callback) {
    Vue.http.get('/user/detail.json', {params:params}).then(function (response) {
      callback(response.data);
    });
  },
  //添加员工
  StaffAdd(params,callback,callback_error) {
    Vue.http.post('/user/add.json', params).then(function (response) {
      callback(response.data);
    }, response => {
      callback_error(response.data)
    });
  },
  //编辑员工
  StaffEdit(params,callback,callback_error) {
    Vue.http.put('/user/modify.json', params).then(function (response) {
      callback(response.data);
    }, response => {
      callback_error(response.data)
    });
  },
  //启用或者禁用员工
  StaffAble(params, callback) {
    Vue.http.put('/user/mgt.json', params).then(function (response) {
      callback(response.data);
    });
  },
  //加载员工权限
  StaffRole(params, callback) {
    Vue.http.get('/role/company/list.json', params).then(function (response) {
      callback(response.data);
    });
  },
  //系统权限
  //删除
  httpDeleteRole (params, callback) {
    Vue.http.delete('/role/delete.json', {params: params}).then((response) => {
      callback(response.data)
    }, (response) => {
    });
  },
  //更新
  httpModifyRole(params, callback_success,callback_error) {
    Vue.http.put('/role/modify.json', params).then(response => {
      callback_success(response.data);
    }, (response) => {
      callback_error(response.data);
    });
  },
  //新增
  httpAddRole(params, callback_success,callback_error) {
    Vue.http.post('/role/add.json', params).then(response => {
      callback_success(response.data);
    },response=>{
      callback_error(response.data)
    });
  },
  //详情
  httpRoleDetail(params, callback){
    Vue.http.get('/role/resource/permission.json', {params: params}).then(function (response) {
      callback(response.data.data);
    });
  },
  //现有权限列表
  httpPermissionList(callback){
    Vue.http.get('/permission/listdata.json').then(function (response) {
      callback(response.data.data);
    });
  },
  //

}
